import Vue from 'vue';
import { registerMicroApps, start, setDefaultMountApp } from 'qiankun';
import App from './App.vue';
import router from './router';
import store from './store';

const apps = [
  {
    name: 'vue', // 微应用package.json的name字段
    entry: 'http://localhost:8110', // 微应用访问地址
    container: '#container', // 容器名
    activeRule: '/sub-vue', // 微应用路由
  },
  {
    name: 'react',
    entry: 'http://localhost:8130',
    container: '#container',
    activeRule: '/sub-react',
  },
  {
    name: 'jquery',
    entry: 'http://localhost:8120',
    container: '#container',
    activeRule: '/sub-jquery',
  },
];
registerMicroApps(apps, {
  beforeLoad: (app) => console.log('before load', app),
  beforeMount: [(app) => console.log('before mount', app.name)],
});
setDefaultMountApp('/sub-vue/about');
// 启动 qiankun
start();
Vue.config.productionTip = false;
new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount('#app');
